/**
 * 模板实例化和个性化设置
 */
import Vue from 'vue';
import baseTpl from "./baseTpl";
import tplConfig from "../src/router.config.js";

//实例化当前模板
const defaultConfig = new baseTpl(tplConfig);

/**
 * 初始化模板
 * @return {[type]} [description]
 */
defaultConfig.init = function() {
	var Router = this.loadRouter();
	this.beforeEnterModule(Router);

	return Router;
};

/**
 * [模块加载前回调函数]
 * @param {[type]} Router [description]
 */
defaultConfig.beforeEnterModule = function(Router) {
	Router.afterEach((to, form) => {
		if (window.__wxjs_is_wkwebview) {
			if (window.entryUrl == '' || window.entryUrl == undefined) {
				window.entryUrl = window.appConfig.baseUrl.slice(0, -1) + to.fullPath;
			}
		} else {
			window.entryUrl = window.appConfig.baseUrl.slice(0, -1) + to.fullPath;
		}
	})
}

export default defaultConfig;














